---
title: Decorators
description: Overview of decorators available to extensions
sidebar_label: Decorators
---

There are decorators exported from `@roots/bud-framework/extension/decorators`.

## @bind

Bind a class method.

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {bind} from '@roots/bud-framework/extension/decorators'

class MyExtension extends Extension {
  @bind
  public myMethod() {}
}
```

## @label

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {label} from '@roots/bud-framework/extension/decorators'

@label('my-extension')
class MyExtension extends Extension {}
```

## @dependsOn

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {dependsOn, label} from '@roots/bud-framework/extension/decorators'

@label('my-extension')
@dependsOn(['@roots/bud-postcss'])
class MyExtension extends Extension {}
```

## @dependsOnOptional

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {
  dependsOnOptional,
  label,
} from '@roots/bud-framework/extension/decorators'

@label('my-extension')
@dependsOnOptional(['@roots/bud-postcss'])
class MyExtension extends Extension {}
```

## @options

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {options, label} from '@roots/bud-framework/extension/decorators'

@label('my-extension')
@options({foo: 'bar'})
class MyExtension extends Extension {}
```

## @plugin

```ts title="extension.ts"
import {Extension} from '@roots/bud-framework/extension'
import {options, label} from '@roots/bud-framework/extension/decorators'
import PluginConstructor from 'webpack-manifest-plugin'

@label('my-extension')
@plugin(PluginConstructor)
class MyExtension extends Extension {}
```
